package com.uduew.sjd.ui.agreement

import com.uduew.sjd.BR
import com.uduew.sjd.R
import com.uduew.sjd.ui.base.BaseFragment
import com.uduew.sjd.ui.base.StateHolder
import com.hjq.bar.OnTitleBarListener
import com.hjq.bar.TitleBar
import com.kunminx.architecture.ui.page.DataBindingConfig
import com.kunminx.architecture.ui.state.State
import com.uduew.sjd.config.Const

class PrivacyFragment : BaseFragment() {
    private lateinit var mStates: PrivacyStates

    override fun initViewModel() {
        mStates = getFragmentScopeViewModel(PrivacyStates::class.java)
    }

    override fun getDataBindingConfig(): DataBindingConfig? {
        return DataBindingConfig(R.layout.fragment_privacy, BR.vm, mStates)
            .addBindingParam(
                BR.click,
                ClickProxy()
            ).addBindingParam(BR.titleBarListener, TitleBarListener())
    }

    inner class TitleBarListener : OnTitleBarListener {
        override fun onLeftClick(titleBar: TitleBar?) {
            super.onLeftClick(titleBar)
            nav().popBackStack()
        }

        override fun onRightClick(titleBar: TitleBar?) {
            super.onRightClick(titleBar)
        }
    }

    open inner class ClickProxy {


    }

    class PrivacyStates : StateHolder() {

        val url: State<String> = State(Const.PRIVACY_URL)
    }
}